<?php

namespace app\home\controller;

use app\BaseController;
use think\App;
use think\facade\Db;

class Common extends BaseController
{
    protected $user;
    public function __construct()
    {
        $token = trim(input('token', ''));
        $user = Db::name('user')->where(['token' => $token])->find();
        if (!$user) {
            echo json_encode(['code' => 1002, 'message' => lang('请登录')]);
            exit;
        }
        $this->user = $user;
    }
}